package com.maybach.core.template;

import com.maybach.util.AssertUtil;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by houenxun on 16/3/7.
 */
public class TemplateFactory {
    private static Map<String, ITemplate> templateMap = new HashMap<String, ITemplate>();

    public static ITemplate getTemplate(String code) {
        AssertUtil.notBlank(code, "code");
        return templateMap.get(code);
    }

    public static void register(ITemplate template) {
        templateMap.put(template.getCode(), template);
    }
}
